package com.example.bykc.demos.controller;

import com.example.bykc.demos.result.AppHttpCodeEnum;
import com.example.bykc.demos.result.ResponseResult;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.bykc.demos.service.service;

import java.util.List;

/**
 * @author wzh
 * @date 2024/5/24
 * @apiNote
 */
@CrossOrigin
@RestController
@RequestMapping
public class controller {

    @Autowired
    private service  service;


    @GetMapping("/demo")
    public ResponseResult process(){
        List result = service.process();
        return  CollectionUtils.isNotEmpty(result)?ResponseResult.okResult(result):ResponseResult.errorResult(AppHttpCodeEnum.FAIL);
    }


}
